<?php
// td1

$sql = "INSERT INTO summary_referrer (seller_id,buyer_id,summary_type,terminal_type,span,date,hour,cvpoint,site_id,item_id,item_type,location_id,buyer_type,campaign_id,article_id,link_id,image_id,keyword_id,page_id,carrier_id,model_id,key_text,imp,imp_uniq,imp_loss,click,click_uniq,cv,cv_uniq,cvi,cvi_uniq,reject,withdraw,cost,wholesale,retail,realtime_cost,realtime_wholesale,cv_app_id,app_store_id,referrer) VALUES  (17896,17897,25,1,1,'2013-12-25',0,0,8,0,0,0,DEFAULT,0,4412,0,0,0,0,0,0,'',3.0,DEFAULT,0,3.0,DEFAULT,0,DEFAULT,0,DEFAULT,0,0,0,0,0,DEFAULT,DEFAULT,0,0,'localhost')";
$tbl1 = "summary_referrer";
$vals = explode($tbl1, $sql);
$vals = explode("VALUES", $vals[1]);

$cols = explode(",", $vals[0]);

$vals = explode(",", $vals[1]);

$cnt = count($cols);
if($cnt != count($vals)) {
	$td1 = 'count cols != count count vals';
} else {
 for ($i = 0; $i < $cnt; $i++) {
	$td1 = $td1 . "$cols[$i]: $vals[$i]<br>";
  }
}

echo "<table border='0'>";
	echo "<tr>";
		echo "<td  style='padding-left: 20'>";
			echo "<b>$tbl1</b><br>";
			echo $td1;
		echo "</td>";
		echo "<td style='padding-left: 20'>";
			echo "<b>$tbl2</b><br>";
			echo $td2;
		echo "</td>";

	echo "</tr>";
echo "</table>";


